<!DOCTYPE html>


<html lang="en">
  

    <head>
      <meta charset="utf-8" />
        
      <meta name="description" content="時光的个人博客" />
      
      <meta
        name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1"
      />
	  <meta name="referrer" content="no-referrer" />

      <title>投屏神器Scrcpy基本使用 |  時光</title>
  <meta name="generator" content="hexo-theme-ayer">
      
      <link rel="shortcut icon" href="/favicon.ico" />
       
<link rel="stylesheet" href="/dist/main.css">

      
<link rel="stylesheet" href="/css/fonts/remixicon.css">

      
<link rel="stylesheet" href="/css/custom.css">
 
      <script src="https://cdn.staticfile.org/pace/1.2.4/pace.min.js"></script>
       
 

      <link
        rel="stylesheet"
        href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
      />
      <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>

      <!-- mermaid -->
      
      <style>
        .swal2-styled.swal2-confirm {
          font-size: 1.6rem;
        }
      </style>
    <link rel="alternate" href="/atom.xml" title="時光" type="application/atom+xml">
</head>
  </html>
</html>


<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-投屏神器Scrcpy基本使用"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  投屏神器Scrcpy基本使用
</h1>
 

      
    </header>
     
    <div class="article-meta">
      <a href="/2022/01/22/%E6%8A%95%E5%B1%8F%E7%A5%9E%E5%99%A8Scrcpy%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" class="article-date">
  <time datetime="2022-01-22T15:09:16.090Z" itemprop="datePublished">2022-01-22</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/categories/%E5%B0%8F%E6%8A%80%E8%83%BD/">小技能</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> Word count:</span>
            <span class="post-count">2k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> Reading time≈</span>
            <span class="post-count">8 min</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <blockquote>
<p><strong>github</strong>: <a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy">https://github.com/Genymobile/scrcpy</a></p>
</blockquote>
<p> <strong>选择下载版本</strong></p>
<p><img src="https://img-blog.csdnimg.cn/8b269d3465464b31a11a69b2c1e39b8d.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5pmC5YWJ5b-D5ZCR6Ziz,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p>
<p><strong>下载操作系统相应的安装包</strong></p>
<p><img src="https://img-blog.csdnimg.cn/8d63811ef1c84149b89d3b92ba9624fc.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5pmC5YWJ5b-D5ZCR6Ziz,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p>
<h2 id="Scrcpy-基本简介"><a href="#Scrcpy-基本简介" class="headerlink" title="Scrcpy 基本简介"></a>Scrcpy 基本简介</h2><p>简单地来说，scrcpy就是通过adb调试的方式来将手机屏幕投到电脑上，并可以通过电脑控制您的Android设备。它可以通过USB连接，也可以通过Wifi连接（类似于隔空投屏），而且不需要任何root权限，不需要在手机里安装任何程序。scrcpy同时适用于GNU &#x2F; Linux，Windows和macOS。</p>
<p><strong>更多详细介绍见</strong> ：<a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#readme">README.md</a></p>
<h2 id="Scrcpy-特征"><a href="#Scrcpy-特征" class="headerlink" title="Scrcpy 特征"></a>Scrcpy 特征</h2><p>它专注于：</p>
<ul>
<li><strong>亮度</strong>：原生，仅显示设备屏幕</li>
<li><strong>性能</strong>：30~120fps，取决于设备</li>
<li><strong>画质</strong>：1920×1080或以上</li>
<li><strong>低延迟</strong>：<a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy/pull/646">35~70ms</a></li>
<li><strong>启动时间短</strong>：显示第一张图像约 1 秒</li>
<li><strong>非侵入性</strong>：设备上没有安装任何东西</li>
<li><strong>用户权益</strong>：无账户、无广告、无需网络</li>
<li><strong>自由</strong>：自由和开源软件</li>
</ul>
<p>其特点包括：</p>
<ul>
<li><a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#recording">记录</a></li>
<li>在<a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#turn-screen-off">设备屏幕关闭的情况下进行</a>镜像</li>
<li>双向<a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#copy-paste">复制粘贴</a></li>
<li><a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#capture-configuration">可配置的质量</a></li>
<li>设备屏幕<a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#v4l2loopback">作为网络摄像头 (V4L2)</a>（仅限 Linux）</li>
<li><a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#physical-keyboard-simulation-hid">物理键盘模拟 (HID)</a> （仅限 Linux）</li>
<li>和更多…</li>
</ul>
<h2 id="使用要求"><a href="#使用要求" class="headerlink" title="使用要求"></a>使用要求</h2><ol>
<li>Android设备至少需要API 21（Android 5.0以上版本）;</li>
<li>确保在您的设备上启用了<a target="_blank" rel="noopener" href="https://developer.android.com/studio/command-line/adb.html#Enabling">adb调试</a>;</li>
<li>在某些设备上，您还需要启用<a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy/issues/70#issuecomment-373286323">其他选项</a>以使用键盘和鼠标控制它。</li>
</ol>
<p>adb调试的开启一般是多次点击手机系统版本，</p>
<p>例如我的是  系统设置 &gt; 关于手机 &gt; 版本信息 &gt;  多次点击软件版本号，直到提示您已处于开发者模式，无需进行此操作</p>
<table>
<thead>
<tr>
<th></th>
<th align="center"><img src="https://img-blog.csdnimg.cn/7201b49ff8d94c218f981fa0de1dad03.png#pic_center" alt="在这里插入图片描述"></th>
<th></th>
</tr>
</thead>
</table>
<p>然后到系统设置 &gt; 开发者选项 &gt; 开启开发者选项 &gt;开启USB调试，如果有USB调试(安全模式)，一定要打开，开启USB调试，USB配置选择文件传输</p>
<table>
<thead>
<tr>
<th><img src="https://img-blog.csdnimg.cn/12ebfa2c4daf40ed9a44344a9aedb802.png#pic_center" alt="在这里插入图片描述"></th>
<th><img src="https://img2023.cnblogs.com/blog/2233039/202311/2233039-20231118160704909-1457463838.png" alt="image-20231118160704772"></th>
<th><img src="https://img-blog.csdnimg.cn/37a9751c754b495490687df732815a80.png#pic_center" alt="在这里插入图片描述"></th>
</tr>
</thead>
</table>
<h2 id="USB连接"><a href="#USB连接" class="headerlink" title="USB连接"></a>USB连接</h2><ol>
<li><p>手机通过USB连接电脑，首次连接会弹出是否信任该电脑，点击始终信任即可。</p>
</li>
<li><p>文件解压后在当前目录地址栏中输入<code>cmd</code>回车打开cmd窗口<br> <img src="https://img-blog.csdnimg.cn/eed7023ae12b4bcf8baccc81843e36ba.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5pmC5YWJ5b-D5ZCR6Ziz,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p>
<p>  或者 <a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_50082325/article/details/121687653?spm=1001.2014.3001.5502">配置系统环境变量</a> 后 使用 Win + R 输入cmd 回车打开cmd窗口</p>
</li>
<li><p>执行命令 <code>adb usb</code> 查看是否连接成功</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">D:\Program Files (x86)\scrcpy<span class="literal">-win64-v1</span>.<span class="number">21</span>&gt;adb usb</span><br><span class="line">restarting <span class="keyword">in</span> USB mode</span><br></pre></td></tr></table></figure>
</li>
<li><p>输入命令 <code>scrcpy</code> 即可</p>
</li>
</ol>
<h2 id="无线连接"><a href="#无线连接" class="headerlink" title="无线连接"></a>无线连接</h2><p>1.确保手机与电脑在同一局域网中(ip的前三段相同)</p>
<pre><code>电脑可通过 `ipconfig` 查看，此处我的为 `192.168.5.236` ,上方显示 `VMware Network Adapter   `为虚拟机ip
</code></pre>
<p><img src="https://img-blog.csdnimg.cn/eb28cb2bbc0643f2be320d4b16c114c1.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5pmC5YWJ5b-D5ZCR6Ziz,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p>
<pre><code>    手机可通过 WLAN &gt; 已连接网络 &gt; IP 查看


 &lt;img src=&quot;https://img-blog.csdnimg.cn/4c45f0c67d574db7b0759d49f0fd05a8.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5pmC5YWJ5b-D5ZCR6Ziz,size_13,color_FFFFFF,t_70,g_se,x_16#pic_center&quot; alt=&quot;image-20211202230435688&quot; style=&quot;zoom:50%;&quot; /&gt;                &lt;img src=&quot;https://img-blog.csdnimg.cn/ff75391524654429a895a155fb85c443.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5pmC5YWJ5b-D5ZCR6Ziz,size_13,color_FFFFFF,t_70,g_se,x_16#pic_center&quot; alt=&quot;image-20211202230300907&quot; style=&quot;zoom:50%;&quot; /&gt;     

    此处我电脑和手机的ip段均为  `192.168.5`  属于同一ip段，所以在同一局域网中
</code></pre>
<ol start="2">
<li><p>手机先通过USB连接电脑(让电脑知道连接那台设备)</p>
</li>
<li><p>在scrcpy目录打开cmd窗口，参见上文</p>
</li>
<li><p>执行命令 <code>adb tcpip 端口号</code> 默认端口号为5555</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">D:\Program Files (x86)\scrcpy<span class="literal">-win64-v1</span>.<span class="number">21</span>&gt;adb tcpip <span class="number">5555</span></span><br><span class="line">restarting <span class="keyword">in</span> TCP mode port: <span class="number">5555</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>断开USB连接</p>
</li>
<li><p>执行命令 <code>adb connect ip : 端口</code></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">D:\Program Files (x86)\scrcpy-win64-v1.21&gt;adb connect 192.168.5.126:5555</span><br><span class="line">connected to 192.168.5.126:5555</span><br></pre></td></tr></table></figure>
</li>
<li><p>执行命令 <code>scrcpy</code> 进行无线连接即可</p>
</li>
</ol>
<h2 id="录制屏幕"><a href="#录制屏幕" class="headerlink" title="录制屏幕"></a>录制屏幕</h2><p>分为两种情况，一种是投屏状态下录屏：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">scrcpy --record file.mp4</span><br><span class="line">scrcpy -r file.mkv</span><br></pre></td></tr></table></figure>

<p>一种是非投屏状态下录屏：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">scrcpy --no-display --record file.mp4</span><br><span class="line">scrcpy -Nr file.mkv</span><br></pre></td></tr></table></figure>

<h2 id="快捷方式"><a href="#快捷方式" class="headerlink" title="快捷方式"></a>快捷方式</h2><p>在下面的列表中，MOD是快捷方式修饰符。<strong>默认情况下，它是 <code>(left)Alt</code>或 (left) Super</strong>。<br>可以使用 进行更改<code>--shortcut-mod</code>。可能的键<code>lctrl</code>，<code>rctrl</code>， <code>lalt</code>，<code>ralt</code>，<code>lsuper</code>和<code>rsuper</code>。例如：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">#使用 RCtrl 作为快捷方式</span><br><span class="line">scrcpy --shortcut-mod=rctrl  #使用右侧ctrl作为快捷方式</span><br><span class="line">scrcpy --shortcut-mod=lctrl+lalt,lsuper  #使用 LCtrl+LAlt 或 LSuper 作为快捷方式</span><br></pre></td></tr></table></figure>

<p><em><a target="_blank" rel="noopener" href="https://en.wikipedia.org/wiki/Super_key_(keyboard_button)">Super</a>通常是Windows或Cmd键。</em></p>
<table>
<thead>
<tr>
<th>行动</th>
<th>捷径</th>
</tr>
</thead>
<tbody><tr>
<td>切换全屏模式</td>
<td>MOD+f</td>
</tr>
<tr>
<td>向左旋转显示</td>
<td>MOD+ ← <em>（左）</em></td>
</tr>
<tr>
<td>向右旋转显示</td>
<td>MOD+ → <em>（右）</em></td>
</tr>
<tr>
<td>将窗口大小调整为 1:1（像素完美）</td>
<td>MOD+g</td>
</tr>
<tr>
<td>调整窗口大小以去除黑色边框</td>
<td>MOD+ w| <em>双击左键¹</em></td>
</tr>
<tr>
<td>点击 <code>HOME</code>         （主页）</td>
<td>MOD+ h| <em>单击中键</em></td>
</tr>
<tr>
<td>点击 <code>BACK</code>            （返回）</td>
<td>MOD+ b| <em>右键单击²</em></td>
</tr>
<tr>
<td>点击 <code>APP_SWITCH</code>       （多任务栏）</td>
<td>MOD+ s| <em>第四次点击³</em></td>
</tr>
<tr>
<td>点击<code>MENU</code>（解锁屏幕）</td>
<td>MOD+m</td>
</tr>
<tr>
<td>点击 <code>VOLUME_UP</code>      （音量+）</td>
<td>MOD+ ↑ <em>（向上）</em></td>
</tr>
<tr>
<td>点击 <code>VOLUME_DOWN</code>          （音量-）</td>
<td>MOD+ ↓ <em>（下）</em></td>
</tr>
<tr>
<td>点击 <code>POWER</code></td>
<td>MOD+p</td>
</tr>
<tr>
<td>打开</td>
<td><em>右键单击²</em></td>
</tr>
<tr>
<td>关闭设备屏幕（保持镜像）</td>
<td>MOD+o</td>
</tr>
<tr>
<td>打开设备屏幕</td>
<td>MOD+Shift+o</td>
</tr>
<tr>
<td>旋转设备屏幕</td>
<td>MOD+r</td>
</tr>
<tr>
<td>展开通知面板</td>
<td>MOD+ n| <em>第 5 次点击³</em></td>
</tr>
<tr>
<td>展开设置面板</td>
<td>MOD+ n+ n| <em>双击 5 次点击³</em></td>
</tr>
<tr>
<td>折叠面板</td>
<td>MOD+Shift+n</td>
</tr>
<tr>
<td>复制到剪贴板⁴</td>
<td>MOD+c</td>
</tr>
<tr>
<td>剪切到剪贴板⁴</td>
<td>MOD+x</td>
</tr>
<tr>
<td>同步剪贴板和粘贴⁴</td>
<td>MOD+v</td>
</tr>
<tr>
<td>注入计算机剪贴板文本</td>
<td>MOD+Shift+v</td>
</tr>
<tr>
<td>启用&#x2F;禁用 FPS 计数器（在标准输出上）</td>
<td>MOD+i</td>
</tr>
<tr>
<td>双指缩放</td>
<td>Ctrl+<em>点击并移动</em></td>
</tr>
<tr>
<td>拖放 APK 文件</td>
<td>从电脑安装APK</td>
</tr>
<tr>
<td>拖放非 APK 文件</td>
<td><a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy#push-file-to-device">推送文件到设备</a></td>
</tr>
</tbody></table>
<p><em>¹双击黑色边框将其删除。</em><br><em>²如果屏幕已关闭，则右键单击可打开屏幕，否则按 BACK。</em><br><em>³第四个和第五个鼠标按钮，如果你的鼠标有它们。</em><br><em>⁴仅适用于 Android &gt;&#x3D; 7。</em></p>
<p>带有重复键的快捷方式通过松开并再次按下该键来执行。例如，要执行“扩展设置面板”：</p>
<ol>
<li>按住MOD。</li>
<li>然后双击n。</li>
<li>最后，释放MOD。</li>
</ol>
<p>所有Ctrl+<em>键</em>的快捷方式被转发到该设备，所以它们被激活的应用程序来处理。</p>
<h2 id="投屏不清晰问题"><a href="#投屏不清晰问题" class="headerlink" title="投屏不清晰问题"></a>投屏不清晰问题</h2><p>找到 <code>scrcpy.exe</code> 右键 &gt; 属性 &gt; 兼容性 &gt; 更改高DPI设置 &gt; 勾选替代高DPI缩放行为 &gt; 确定应用即可</p>
<p><img src="https://img-blog.csdnimg.cn/ba3c612ed7a0462bafe0210d8c193534.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5pmC5YWJ5b-D5ZCR6Ziz,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center" alt="在这里插入图片描述"></p>
<h2 id="常见错误"><a href="#常见错误" class="headerlink" title="常见错误"></a>常见错误</h2><ol>
<li><p><code>error: more than one device/emulator</code></p>
<p>报错原因：多个设备连接了电脑，导致adb无法识别操作具体哪台设备</p>
<p>可通过命令 <code>adb devices</code> 查看已连接设备</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">D:\Program Files (x86)\scrcpy<span class="literal">-win64-v1</span>.<span class="number">21</span>&gt;adb devices</span><br><span class="line">List of devices attached</span><br><span class="line">SKPN45IF8DBMRG59        device</span><br><span class="line"><span class="number">192.168</span>.<span class="number">5.126</span>:<span class="number">5555</span>      device</span><br></pre></td></tr></table></figure>

<ul>
<li><p>若想选择其中一个设备，可以执行以下命令连接其中一个设备</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">scrcpy --serial SKPN45IF8DBMRG59</span><br><span class="line"># 或者</span><br><span class="line">scrcpy -s SKPN45IF8DBMRG59</span><br></pre></td></tr></table></figure>
</li>
<li><p>也可以用<code>adb -s SKPN45IF8DBMRG59 shell</code>，进入该设备操作</p>
</li>
<li><p>若不想进入shell模式，则执行 <code>adb -s SKPN45IF8DBMRG59  指令</code>（如 adb -s SKPN45IF8DBMRG59 shell input keyevent 3）</p>
</li>
<li><p>如果只有一个模拟器和一个手机连着电脑</p>
<ul>
<li>可以用<code>adb -e</code> 来指明是操作模拟器（Emulator）</li>
<li>可以用<code>adb -d </code>来指明是操作设备（Device）</li>
</ul>
</li>
</ul>
<p>此处我是由于已进行无线连接（可以看到连接设备有 <code>192.168.5.126:5555      device</code>）又连接了US</p>
<p>只需拔掉USB，执行<code>scrcpy</code> 重新连接即可</p>
</li>
<li><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">[<span class="type">server</span>] ERROR: Exception on thread Thread[<span class="type">main</span>,<span class="number">5</span>,<span class="type">main</span>]</span><br><span class="line">java.lang.IllegalStateException</span><br><span class="line">        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)</span><br><span class="line">        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:<span class="number">2792</span>)</span><br><span class="line">        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:<span class="number">110</span>)</span><br><span class="line">        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:<span class="number">91</span>)</span><br><span class="line">        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:<span class="number">65</span>)</span><br><span class="line">        at com.genymobile.scrcpy.Server.scrcpy(Server.java:<span class="number">93</span>)</span><br><span class="line">        at com.genymobile.scrcpy.Server.main(Server.java:<span class="number">309</span>)</span><br><span class="line">        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)</span><br><span class="line">        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:<span class="number">372</span>)</span><br><span class="line">INFO: Renderer: direct3d</span><br><span class="line">INFO: Initial texture: <span class="number">1080</span>x2336</span><br><span class="line">WARN: Device disconnected</span><br></pre></td></tr></table></figure>

<p>报错原因：已连接设备不支持默认分辨率设置</p>
<p>可使用如下命令打开</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 三者任选其一</span></span><br><span class="line">scrcpy <span class="literal">-m</span> <span class="number">1920</span></span><br><span class="line">scrcpy <span class="literal">-m</span> <span class="number">1024</span></span><br><span class="line">scrcpy <span class="literal">-m</span> <span class="number">800</span></span><br></pre></td></tr></table></figure>

<ol start="3">
<li><p><code>cannot connect to 192.168.X.X:5555: 由于目标计算机积极拒绝，无法连接。 (10061)</code></p>
<ol>
<li>首先检查要连接的手机是否已开启adb调试</li>
<li>开启手机adb服务端口及adb调试功能</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">D:\Program Files (x86)\scrcpy-win64-v1.21&gt;adb shell # 进入安卓系统shell</span><br><span class="line">PD1831:/ $ setprop service.adb.tcp.port 5555 #设置adb服务端口为5555，打开adb网络调试功能</span><br><span class="line">PD1831:/ $ setprop service.adb.tcp.port -1  # 打开adb的usb调试功能。</span><br><span class="line">PD1831:/ $ exit # 退出shell</span><br></pre></td></tr></table></figure>

<ol start="3">
<li>cmd输入命令  <code>adb tcpip 5555</code>   让设备在 5555 端口监听 TCP&#x2F;IP 连接。</li>
<li>cmd 输入命令 <code>adb connect ip:端口</code> 即可连接成功</li>
</ol>
</li>
</ol>
</li>
</ol>
<blockquote>
<p><strong>参考</strong></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/was172/article/details/99705855">scrcpy——Android投屏神器(使用教程)</a></p>
</blockquote>
 
      <!-- reward -->
      
      <div id="reword-out">
        <div id="reward-btn">
          Donate
        </div>
      </div>
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>Copyright： </strong>
          
          Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://example.com/2022/01/22/%E6%8A%95%E5%B1%8F%E7%A5%9E%E5%99%A8Scrcpy%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Scrcpy/" rel="tag">Scrcpy</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/2022/01/22/Vscode%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            Vscode使用指南
          
        </div>
      </a>
    
    
      <a href="/2022/01/22/Navicat%20%E6%9F%A5%E7%9C%8B%E6%9C%AC%E5%9C%B0%E8%BF%9E%E6%8E%A5%E5%AF%86%E7%A0%81/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">Navicat 查看本地连接密码</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.staticfile.org/valine/1.4.16/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "dx3B54wOwhi75vxC2IAZagtg-gzGzoHsz",
    app_key: "m4k2fhnFa1iPI4vbofHqMY5X",
    path: window.location.pathname,
    avatar: "monsterid",
    placeholder: "给我的文章加点评论吧~",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
   
  
   
    <script src="https://cdn.staticfile.org/twikoo/1.4.18/twikoo.all.min.js"></script>
    <div id="twikoo" class="twikoo"></div>
    <script>
        twikoo.init({
            envId: ""
        })
    </script>
 
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2023
        <i class="ri-heart-fill heart_icon"></i> Shiguang
      </li>
    </ul>
    <ul>
      <li>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>Visitors:<span id="busuanzi_value_site_uv"></span></span>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>Views:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>    
    </main>
    <div class="float_btns">
      <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

    </div>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="時光"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/friends">友链</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-3.6.0.min.js"></script>
 
<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->
 
<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: ".tocbot",
    contentSelector: ".article-entry",
    headingSelector: "h1, h2, h3, h4, h5, h6",
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: "main",
    positionFixedSelector: ".tocbot",
    positionFixedClass: "is-position-fixed",
    fixedSidebarOffset: "auto",
  });
</script>

<script src="https://cdn.staticfile.org/jquery-modal/0.9.2/jquery.modal.min.js"></script>
<link
  rel="stylesheet"
  href="https://cdn.staticfile.org/jquery-modal/0.9.2/jquery.modal.min.css"
/>
<script src="https://cdn.staticfile.org/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->
 <!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.staticfile.org/photoswipe/4.1.3/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/photoswipe/4.1.3/default-skin/default-skin.min.css">
<script src="https://cdn.staticfile.org/photoswipe/4.1.3/photoswipe.min.js"></script>
<script src="https://cdn.staticfile.org/photoswipe/4.1.3/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script> 
<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->
 
<script src="/js/busuanzi-2.3.pure.min.js"></script>
 
<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->
 
<link rel="stylesheet" href="/css/clipboard.css">
 <script src="https://cdn.staticfile.org/clipboard.js/2.0.10/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>
 
<!-- CanvasBackground -->

<script>
  if (window.mermaid) {
    mermaid.initialize({ theme: "forest" });
  }
</script>


    
    

  </div>
</body>

</html>